import request from '@/utils/request'
/**
 * 获取组织架构信息的接口
 * @returns
 */
export function getDepartment() {
  return request({
    url: '/company/department',
    method: 'get'
  })
}

/**
 * 根据部门id删除
 * @param {Integer} id
 * @returns
 */
export function delDepartment(id) {
  return request({
    url: `/company/department/${id}`,
    method: 'delete'
  })
}

/**
 * 新增部门
 * @param {Object} data
 * @returns
 */
export function addDepartment(data) {
  return request({
    url: '/company/department',
    method: 'post',
    data
  })
}

/**
 * 获取某个部门的详情
 * @param {*} id
 * @returns
 */
export function getDepartDetail(id) {
  return request({
    url: `/company/department/${id}`
  })
}

/**
 * 保存编辑的数据
 * @param {*} data
 * @returns
 */
export function updateDepartment(data) {
  return request({
    url: `/company/department/${data.id}`,
    method: 'put',
    data
  })
}
